import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore('warehouse', () => {
    // 判断是否登录
    const userState = ref(window.localStorage.getItem('userState')==='true')
    // function setUserState(val:boolean){
    //     userState.value = val
    // }

    // 获取用户id
    // const userId = ref(window.localStorage.getItem('userid')||'')
    // function setUserId(id:string){
    //     userId.value = id
    // }
  
    // 获取用户电话号码(账号)
    const username = ref(window.localStorage.getItem('username'))

    return {userState,username }
  },{ persist: { storage: window.localStorage } })